package com.qf.bigdata.service.impl;

import com.qf.bigdata.bean.UserEmbeddingResult;
import com.qf.bigdata.repository.MilvusTemplate;
import com.qf.bigdata.service.UserEmbeddingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

@Service("userEmbeddingService")
public class UserEmbeddingServiceImpl implements UserEmbeddingService {
	
    @Autowired
    @Qualifier("milvusTemplate")
    private MilvusTemplate milvusTemplate;

    @Override
    public UserEmbeddingResult searchSimUserById(Long uid, int topK) {
		
        UserEmbeddingResult result = new UserEmbeddingResult();
        result.setCode(200);
        result.setMsg("ok");
        result.setData(milvusTemplate.searchIPVectorById("user_embedding",uid,topK));
        return result;
    }
	
}
